package controllers;

import play.*;
import play.mvc.*;
import play.mvc.Http.Response;

import file.FileManipulator;
import image.PixelImage;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.*;

import models.*;

public class Application extends Controller {

	public static String PIXELFILE = "320.dat";
	public static PixelImage image = new PixelImage(PIXELFILE);
	
    public static void map() {
    	Datafile_jl dataFile = Datafile_jl.find("byDatafile_id", 272).first();
    	System.out.println(dataFile.filename);
    	
    	List<Datafile_perm_jl> list2 = Datafile_perm_jl.find("byDatafile_id", 320).fetch();
    	System.out.println("test: " + list2.size());
//    	System.out.println(list2.get(2).permname);
    	for (Datafile_perm_jl d : list2) {
    		System.out.println("TEST: " + d.datafile_perm_id);
    	}
    	render(list2);
    }
    
    public static void tile(int img, int x, int y, int z) {
    	renderBinary(image.getTile(x, y, z));
    }
}